
import { Template } from 'meteor/templating';

import { Posts } from '/imports/api/posts/posts.js';
import { Tracker } from 'meteor/tracker'

import '../item/item.js';
import './items.html';
import '../modals/show_post.js';

import { Message } from '../message/message.js'

Template.post_items.onCreated(function(){


});
Tracker.autorun((c)=> {
		if (Posts.find().count()>0) {

			if ($("#post-loader").hasClass('active')) {
				$("#post-loader").removeClass('active');
			}
		}
	});
Template.post_items.onRendered(function(){
	$("#post-loader").addClass('active');
	if (Posts.find().count()>0) {
			if ($("#post-loader").hasClass('active')) {
				$("#post-loader").removeClass('active');
			}
		}
});



Template.post_items.helpers({
  posts() {
  	if (Posts.find().count()>0) {
			$("#post-loader").removeClass('active');
		}
    return Posts.find({});
  },
});
